//      explorer.h
//      
//      Copyright 2011 DJ Shaji <djshaji@gmail.com>
//      
//      This program is free software; you can redistribute it and/or modify
//      it under the terms of the GNU General Public License as published by
//      the Free Software Foundation; either version 2 of the License, or
//      (at your option) any later version.
//      
//      This program is distributed in the hope that it will be useful,
//      but WITHOUT ANY WARRANTY; without even the implied warranty of
//      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//      GNU General Public License for more details.
//      
//      You should have received a copy of the GNU General Public License
//      along with this program; if not, write to the Free Software
//      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
//      MA 02110-1301, USA.


#ifndef EXPLORER_H
#define EXPLORER_H

#include <gdk/gdkkeysyms.h>
#include <april/april.h>

#include "hotkeys.h"

typedef struct _ExplorerConfig {
	gint click_mode ;
} ExplorerConfig ;

typedef struct _Explorer {
	ExplorerConfig config ;
	
	GtkBox * pack ;
	GtkWindow * window ;
	GtkMenuBar * menubar ;
	GtkToolbar * toolbar ;
	GtkBox * addressbar ;
	GtkBox * iconbox ;
	GtkIconView * iconview ;
	GtkStatusbar * statusbar ;
	
	// Explorer
	GtkTreeModel * store ;
	GtkTreeModel * history_back, * history_forward ;
	
	GtkToolItem * anim ;
	GdkPixbufAnimation * anim_p ;
	gint counter ;
	
	// Memory
	GMemChunk * mem ;
	
	// Addressbar
	GtkComboBoxEntry * addressbar_entry ;

	// Internal sanity checks
	glong timestamp ;
	
	// Cut / copy / paste
	GtkClipboard * clipboard ;
	GtkMenu * favorites ;
	GtkMenuItem * f_item ;
} Explorer ;

typedef enum _ClipboardAction {
	CUT,
	COPY,
	PASTE
} ClipboardAction ;

typedef enum _SendtoTargets {
	SEND_TO_DEVICE,
	SEND_TO_DOCUMENTS,
	SEND_TO_DESKTOP,
	SEND_TO_NONE
} SendtoTargets ;

typedef struct _Sendto {
	Explorer * e ;
	SendtoTargets target ;
	
	GMemChunk * memory ;
} Sendto ;


static gchar * send_to_targets [] = {
	"Devices",
	"My Documents",
	"Desktop",
	null
} ;

Explorer * explorer_new ( void ) ;
void explorer_create_menubar ( Explorer * e ) ;
void explorer_create_toolbar ( Explorer * e ) ;

void explorer_create_addressbar ( Explorer * e ) ;
void explorer_new_instance ( gchar * folder ) ;
void explorer_set_status_message ( Explorer * e, gchar * message ) ;
void explorer_nullify_variables ( Explorer * e ) ;
gchar * explorer_get_current_folder ( Explorer * e ) ;

void fm_go_forward ( Explorer * e ) ;
void fm_go_back ( Explorer * e ) ;
void fm_go_up ( Explorer * e ) ;

void fm_icon_view_activated ( GtkWidget * icon_view, GtkTreePath * path, Explorer * e ) ;

void explorer_wait_anim_start ( Explorer * e ) ;
void explorer_wait_anim_stop ( Explorer * e ) ;

#define WAIT_ANIMATION "explorer/wait.gif"
void explorer_addressbar_activated ( GtkWidget * entry, Explorer * e ) ;
gboolean explorer_addressbar_process_keypress_event ( GtkWidget * widget, GdkEventKey * event, Explorer * e ) ;

void explorer_fire_event ( Explorer * e ) ;
GList * explorer_get_selected_files ( Explorer * e ) ;

void explorer_copy_to_clipboard ( Explorer * e, ClipboardAction action ) ;
void explorer_paste_from_clipboard ( Explorer * e ) ;
void explorer_paste_from_clipboard_callback ( GtkClipboard * clipboard, gchar * text, Explorer * e ) ;
void explorer_cut_callback ( Explorer * e ) ;
void explorer_copy_callback ( Explorer * e ) ;

void hotkeys ( GtkWidget * widget, GdkEventKey * event, Explorer * e ) ;
GList * traverse_through_directory ( GList * list, gchar * folder ) ;
void explorer_delete_selected_files ( Explorer * e ) ;
void explorer_open_with ( Explorer * e ) ;
gboolean fm_handle_context_menu ( GtkWidget * widget, GdkEventButton * event, Explorer * e ) ;
void _explorer_activate ( Explorer * e ) ;
gint fm_sort_func ( gchar * data1, gchar * data2 ) ;
void explorer_send_to ( GtkWidget * widget, Sendto * sendto ) ;
void explorer_create_shortcut ( Explorer * e ) ;
void explorer_rename ( Explorer * e ) ;
void explorer_file_info ( Explorer * e ) ;

void explorer_delete_from_clipboard ( Explorer * e ) ;
void explorer_delete_from_clipboard_callback ( GtkClipboard * clipboard, gchar * text, Explorer * e ) ;
void _explorer_paste_shortcut ( GtkClipboard * clipboard, gchar * text, Explorer * e ) ;
void explorer_paste_shortcut ( Explorer * e ) ;
void explorer_destroy ( Explorer * e ) ;
gchar * explorer_get_current_file ( Explorer * e ) ;
void explorer_about ( void ) ;

#endif
